﻿@model IEnumerable<Irandeb4.Models.User>

@{
    ViewBag.Title = "Search";
}

<h2>Buscar Usuario</h2>

@using (Html.BeginForm())
{
    <center>
        <div>
            <input type="text" id="searchFieldID" name="toSearch"/> 
            <input type="submit" value="buscar" />   
        </div>
        
        <br/>
        <div>
            @Html.RadioButton("searchCriteria", "active", false)activos
            @Html.RadioButton("searchCriteria", "inactive", false)inactivos
            @Html.RadioButton("searchCriteria", "all", true)todos
        </div>
    </center>
    <br/>

    <div>
        <a href="Search">ver todas</a>
    </div>
    <table class="table2">
        <tr>
            <th>
                Nombre Usuario
            </th>
            <th>
                Email
            </th>
            <th>
                Rol
            </th>
            <th>
                Nombres
            </th>
            <th>
                Apellidos
            </th>
            <th>
                Acciones
            </th>
        </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.UserName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
               @Html.DisplayFor(modelItem => item.UserRole.Role)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Employee.Names)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Employee.Surnames)
            </td>
            <td>
                @Html.ActionLink("Modificar", "Edit", new { id = item.UserId }) |
                @Html.ActionLink("Ver", "Details", new { id = item.UserId }) |
                @Html.ActionLink("Cambiar Estado", "Delete", new { id = item.UserId })
            </td>
        </tr>
    }

    </table>
}
